#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <string>

using namespace std;

// Delcare the global value

string str1;
string str2;
vector<char> io;
stack<char> sk;

void dfs(int i, int o)
{
	if(i == o && i == str1.length())
	{
		int index = 0;
		for(index = 0;index < (int) io.size();index ++)
		{
			cout << io[index] << " ";
		}
		cout << endl;
	}

	if(i < (int) str1.length())
	{
		io.push_back('i');
		sk.push(str1[i]);
		dfs(i + 1, o);

		io.pop_back();
		sk.pop();
	}

	if(o < i && o < (int) str1.length() && sk.top() == str2[o])
	{
		char tmp = sk.top();
		sk.pop();
		io.push_back('o');

		dfs(i, o + 1);

		sk.push(tmp);
		io.pop_back();
	}
}

int main()
{
	//freopen("input.txt", "r", stdin);
	while(cin >> str1 >> str2)
	{
		string tmp1 = str1;
		string tmp2 = str2;

		sort(tmp1.begin(), tmp1.end());
		sort(tmp2.begin(), tmp2.end());
		cout << "[" << endl;
		if(tmp1 == tmp2)
			dfs(0, 0);
		cout << "]" << endl;
	}
	return 0;
}
